package day_2022_9_to_12.Day;

/**
 * @author haomin
 * @date 2022/09/23 21:53
 **/
public class Day22_3_Num114_Flatten {
    class Solution {
        TreeNode pre = new TreeNode();
        public void flatten(TreeNode root) {
            if(root == null) return;
            TreeNode left = root.left;
            TreeNode right = root.right;

            pre.left = null;
            pre.right = root;
            pre = root;
            flatten(left);
            flatten(right);
        }
    }
}